"""
登录成功测试
"""
import pytest
from Config.Base import Base
from playwright.sync_api import Page, expect, Playwright
import allure
from Config.URL import *
from Config.config import *
import os

@pytest.mark.基础管理系统
@pytest.mark.登录
def test_case(playwright : Playwright) -> None:
    SetupTeardown = Base(playwright)
    SetupTeardown.goto("http://172.18.3.53:7300/#/login")
    SetupTeardown.login(username_admin, password_admin)
    page = SetupTeardown.page
    expect(page.locator("#tags-view-container")).to_contain_text("项目首页")
    # 测试结果截图
    filename = os.path.join(test_screenshot_dir, f"{'登录成功'}.png")
    page.screenshot(path=filename)
    allure.attach.file(source=filename, name='登录成功',
                       attachment_type=allure.attachment_type.PNG)

    SetupTeardown.close()
